import Vue from 'vue'

import Vuex from 'vuex'

Vue.use(Vuex)

//首页tab传输催出的值
const list = {
	listing: []
}
const load = {
	loading: ''
}
const navmin = {
	loading: '',
	naving: 'recomment',
	pageid: 0,
	uniload: '',
	nonedata:''
}
const nonemin = {
	nonedata: ''
}
const city = {
	citying:''
}
const travecity ={
	traveing:''
}
//数据仓库
const state = {
	list,
	load,
	navmin,
	nonemin,
	city,
	travecity
}


export default new Vuex.Store({
	state,
	actions: {
		listact(listact, listdata) {
			listact.commit('listmut', listdata)
		},
		loadmuat(loadmuat, loading) {
			loadmuat.commit('loadmuat', loading)
		},
		navmuta(navmuta, pullobj) {
			navmuta.commit('navmuta', pullobj)
		}
	},
	mutations: {
		listmut(state, listdata) {
			state.list = {
				listing: listdata
			}
		},
		// tab切换状态
		loadmuat(state, loading) {
			console.log('store中tab切换时转圈圈为', loading)
			state.load = {
				loading: loading
			}
		},
		//以对象形式传过来的参数
		navmuta(state, pullobj) {
			state.navmin = {
				loading: pullobj.loading,
				naving: pullobj.nav,
				pageid: pullobj.pageid,
				uniload: pullobj.uniload,
				nonedata: pullobj.nonedata
			}
		},
		nonemuta(state, nonedata) {
			state.nonemin = {
				nonedata: nonedata
			}
		},
		citymuta(state,cityion){
			state.city = {
				citying:cityion
			}
		},
		travemuta(state,cityion){
			state.travecity = {
				traveing:cityion
			}
		},
	}
})
